<template>
  <div class="wrap container">
    <headerCom @sendHeaderData="handleHeaderData" />
    <div class="btnDiv">
      <el-button type="primary" v-hasPermi="['screen:job:add']">新增毕业学生</el-button>
      <el-button type="primary" plain v-hasPermi="['screen:job:allDel']">批量删除</el-button>
      <el-button type="primary" v-hasPermi="['screen:job:import']">学生批量导入</el-button>
      <el-button type="primary" v-hasPermi="['screen:big:export']">学生信息导出</el-button>
    </div>

    <contentTable v-bind="TableConfig">
      <template #Operate="scope">
        <el-button type="text" size="mini">查看</el-button>
        <el-button type="text" size="mini">编辑</el-button>
        <el-button type="text" size="mini">删除</el-button>
      </template>
    </contentTable>
  </div>
</template>
<script setup>
/**
 * 模块引入
 */
import { reactive, ref } from "vue";
import headerCom from "./components/headerCom";
import { getStudentListApi } from "@/api/bigScreen/index.js";
import dayjs from "dayjs";
/**
 * 数据
 */

const params = reactive({
  limit: "10", // 每页数据量 必填
  skip: "0", // 起始下标
  stuName: "", // 学生姓名
  origin: "", //  市场部
  collegeId: "", // 学院id
  workCity: "", // 工作城市
});
const TableConfig = reactive({
  tableHeader: [
    //展示表格哪些列
    { label: "学生姓名", prop: "stuName", type: "text" },
    { label: "班级", prop: "className", type: "text" },
    { label: "学院名称", prop: "collegeName", type: "text", width: "150" },
    { label: "专业", prop: "expertiseName", type: "text" },
    { label: "上班城市", prop: "workCity", type: "text" },
    { label: "毕业薪资", prop: "salary", type: "text" },
    { label: "学生状态", prop: "status", type: "text" },
    { label: "市场部来源", prop: "origin", type: "text" },
    { label: "毕业年份", prop: "gradYear", type: "text" },
    { label: "创建时间", prop: "createdTime", type: "text", width: "150" },
    { label: "操作列", prop: "Operate", type: "slot", width: "200" },
  ],
  tableData: [], //展示表格数据
  OtherConfig: {
    showCheckBox: true,
  },
});
/**
 * 功能方法
 */
const handleHeaderData = async (data) => {
  let paramsData = Object.assign(params, data);
  getStudentList(paramsData);
};
const getStudentList = async (val) => {
  const res = await getStudentListApi(val);
  TableConfig.tableData = res.data.result;
  TableConfig.tableData.forEach((item, index) => {
    item.createdTime = dayjs(item.createdTime).format("YYYY-MM-DD");
  });
  console.log(TableConfig.tableData);
};
onMounted(() => {
  getStudentList(params);
});
</script>
<style lang="scss" scoped>
.container {
  padding: 20px;
}
.btnDiv {
  margin-bottom: 20px;
}
</style>
